package lesson14;

public class Car 
{
	String model;
	int maxSpeed;
	int currentSpeed;
	String color;
	byte currentGear;
	Person owner;
	
	void accelerate()
	{
		currentSpeed += 10;
		if(currentSpeed >= maxSpeed)
		{
			currentSpeed = maxSpeed;
		}
	}
	
	void changeGearUp()
	{
		if(currentGear <=5)
		{
			currentGear++;
		}
	}
	
	void changeGearDown()
	{
		if (currentGear >0) 
		{
			currentGear--;
		}
	}
	
	void changeGear(int nextGear)
	{
		if(currentSpeed >30 || currentSpeed < 60)
		{
			currentGear = 2;
		}
		else if (currentSpeed >= 60 || currentSpeed <100) 
		{
			currentGear = 3;
		}
		else if(currentSpeed >= 100 || currentSpeed < 130)
		{
			currentGear = 4;
		}
		else if(currentSpeed >= 130)
		{
			currentGear = 5;
		}
		else
		{
			
		}
	}
	
}
